import request from '@/utils/request'

let baseMapping = "/user_service/";

export default {

  // 分页获取用户信息
  getList(current, limit, user) {
    return request({
      url: baseMapping + `getUser/${current}/${limit}`,
      method: 'post',
      data: user
    })
  },

  // 通过id获取用户信息
  getUser(id) {
    return request({
      url: baseMapping + `getUserInfo/${id}`,
      method: 'get'
    })
  },

  // 通过token获取用户信息
  getUserInfoByToken() {
    return request({
      url: baseMapping + `getUserInfoByToken`,
      method: 'get'
    })
  },

  // 登录
  login(user) {
    return request({
      url: baseMapping + `login`,
      method: 'post',
      data: user
    })
  },

  // 修改用户信息
  updateUser(user) {
    return request({
      url: baseMapping + `updateUser`,
      method: 'post',
      data: user
    })
  },

  // 注册账号
  register(registerVo) {
    return request({
      url: baseMapping + `register`,
      method: 'post',
      data: registerVo
    })
  }
}
